<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once("../Scripts/DatabaseConnect.php");
require_once("../Scripts/authenticate.php");//Only users who are logged in can access this page
require_once("../Scripts/UpdateStocks.php");//Checks if we need to update the database with new market data.
require_once("../Scripts/CheckPortfolioMonitor.php");//Script where the CheckPortfolio($con) function comes from
require_once("../Scripts/CheckNewSymbolsMonitor.php");//Script where the CheckNewSymbols($con) function comes from


//Check if we need local server or remote server
$con=Remoteconnect();
if($con==null){
	$con=Localconnect();	
}
//Display the last update date and current date and time.
$lastUpdate="";
$result = mysqli_query($con,"SELECT * FROM  `time`");

while($row = mysqli_fetch_array($result)) {
	$lastUpdate=$row['LastUpdate'];

  
}

$date = date('m-d-Y h:i:s a', time());//gets current date and time of server.
echo"Date: $date, Last Update: $lastUpdate";
session_start();
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr">
<head profile="http://gmpg.org/xfn/11">
<title>J&J Free Stock backtesting</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet" href="businesstoday/styles/layout.css" type="text/css" />
</head>
<body id="top" onload="Hide()" >
<div class="wrapper col1">
  <div id="header">
    <img src="../Images/the-top-5-high-volume-trading-stocks-of-the-week_1118_437849_0_14042581_500.jpg" alt="" width="240" height="162" />
    <div id="logo">
      <h1>J&amp;J Free Stock Backtesting    </h1>
    </div>
    <div id="newsletter">
    <div id="login" style="display:block; min-height:50px; min-width:600px;">
      <p><a href="#">Lost your password?</a> <a href="register.php">Register</a>

      </p>
      
      <form action="../Scripts/authenticate.php" method="post" >
      
        <fieldset>
          <legend>NewsLetter</legend>
          <table>
            <tr>
              <td>Name:</td>
              <td><input type="email" name="email" required="required" id="email" /></td>
              <td>Password:</td>
              <td><input type="password" name="password" required="required" id="password" /></td>
              <td><input type="submit" name="news_go" id="news_go" value="Login" /></td>
            </tr>
          </table>
        </fieldset>
      </form>


      </div>
      
      <?php
	  //Wrong password message
      if (isset($_SESSION['msg'])) {
	echo "<p style='color:red'>".$_SESSION['msg']."</p>"; 
	//remove the message since it has been displayed.
	unset($_SESSION['msg']);
	}
	?>
    
   	<?php
	//logout button
    if (isset($_SESSION['msgG'])) {
		echo"<form>";
		echo "<p style='color:green'>".$_SESSION['msgG']."</p>"; 
		echo '<input type="button" name="logout" id="logout" value="Logout" onClick="location.href=\'../Scripts/Logout.php\'"/>'; 
		echo"</form>";
	}
	
?> 
  

    </div>
    <br class="clear" />
  </div>
</div>

<div class="wrapper col2">
  <div id="topbar">
    <div id="topnav">
      <ul>
        <li class="active">
         
              <li><a href="index.php">Home Page</a></li>
              <li id="portfolio" style="display:none"><a href="portfolio.php">Stock Portfolio</a></li>
              <li id="stockMonitoring" style="display:none"><a href="stockMonitoring.php">Stock Monitoring</a></li>
              <li><a href="stockbacktest.php">Stock Backtest</a></li>
              <li><a href="charts.php">Stock Charts</a>
               <ul>
            <li><a href="chartDifShares.php">Stock Prices Comparision Chart</a></li>
            <li><a href="chartIndicators.php">Stock Technical Analysis Chart</a></li>
         
          </ul>
        </li>

        
  </li>      
        
        
      </ul>
    </div>

 
       
    
<script >
		//login formating hiding/showing navigation bar links based on logged in status.
		var check = <?php echo json_encode(isset($_SESSION['email'])); ?>;
	  
	  if(check==true){
		 
		  document.getElementById("login").style.display="none";
		  document.getElementById("portfolio").style.display="block";
		  document.getElementById("stockMonitoring").style.display="block";
	  }else{
		  document.getElementById("login").style.display="block";
		  document.getElementById("stockMonitoring").style.display="none";
		  document.getElementById("portfolio").style.display="none"; 
	  }
//Hiding/ showing divs.
function ShowStategey(){
	if(document.getElementById("AddStrategy").style.display=="block"){
		document.getElementById("AddStrategy").style.display="none";	
	}else{
		document.getElementById("AddStrategy").style.display="block";	
		
	}
}

function Hide(){
		document.getElementById("AddStrategy").style.display="none";
		document.getElementById("CheckPortfolio_div").style.display="none";
		document.getElementById("CheckPortfolio_div").style.display="none";	

}

function ShowPortfolio(){
	if(document.getElementById("CheckPortfolio_div").style.display=="block"){
		document.getElementById("CheckPortfolio_div").style.display="none";
	}else{
		document.getElementById("CheckPortfolio_div").style.display="block";
	}
}

function ShowNewSymbols(){
	if(document.getElementById("CheckNewSymbols_div").style.display=="block"){
		document.getElementById("CheckNewSymbols_div").style.display="none";
	}else{
		document.getElementById("CheckNewSymbols_div").style.display="block";
	}
}

function EditStrategies(){
	if(document.getElementById("EditStrategies_div").style.display=="block"){
		document.getElementById("EditStrategies_div").style.display="none";	
	}else{
	document.getElementById("EditStrategies_div").style.display="block";
	}
}
</script>
    <br class="clear" />
  </div>
</div>
<div class="wrapper col3">
  <div id="intro">
    <div class="fl_right"></div>

    <br class="clear" />
  </div>
</div>
<div class="wrapper col4"></div>
<div class="wrapper col5">
  <div id="container">
   
    <div id="content">
      <h2>Stock Monitoring</h2>
      <p>You can define buying and selling strategies that will be tested using the most recent stock market data to indicate whether you should buy or sell a particular symbol.</p>
     
	 <?php
	 //feedback for the user on the forms they have submitted.
    if (isset($_SESSION['FeedbackGood'])) {
	echo "<p style='color:green'>".$_SESSION['FeedbackGood']."</p>"; 
	unset($_SESSION['FeedbackGood']);

}

     if (isset($_SESSION['FeedbackBad'])) {
	echo "<p style='color:red'>".$_SESSION['FeedbackBad']."</p>"; 
	unset($_SESSION['FeedbackBad']);
}
	
?>
      <input type="button" value="Add Strategy" onclick="ShowStategey()" id="Add"/>
		<div id="AddStrategy" style="display:none;">
        <form action="../Scripts/stockMonitoringProcess.php" method="post" id="Add Strategy">
        <label>Name:</label>
        <input type="text" id="Name" name="Name" required="required"/>
        
        <table width="200" border="1">
              <tr>
                <td>Buy when:</td>
                <td><select id="Buy1_1" name="Buy1_1"onchange="AutoInput('Buy1_1','BuyInput1_1')" >
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="Close">Closing Price</option>
                  <option value="Open">Opening Price</option>
                  <option value="High">High</option>
                  <option value="Low">Low</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                  <option value="SAR">SAR(acceleration/maximum)</option>
                  <option value="WMA">WMA</option>
                  <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		 
                  <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                  <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="ROC">ROC(days)</option>
                  <option value="OBV">OBV</option>
                  <option value="PVT">PVT</option>
                  <option value="WilliamR">WilliamR(days)</option>
                  <option value="MTM">MTM(days)</option>
                  <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                  
                </select></td>

                <td>IS:</td>
                <td><select id="Buy1_2" name="Buy1_2"onchange="AutoInput('Buy1_2','BuyInput1_2')">
                  <option value="" selected></option>
                  <option value="Above">Above</option>
                  <option value="Below">Below</option>
                  <option value="AtLeast%Above%">At least % above (%)</option>
                  <option value="AtLeast%Below%">At Least % below (%)</option>
                </select></td>
                <td>Then the:</td>
                <td><select id="Buy1_3" name="Buy1_3"onchange="AutoInput('Buy1_3','BuyInput1_3')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="Close">Closing Price</option>
                  <option value="Open">Opening Price</option>
                  <option value="High">High</option>
                  <option value="Low">Low</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                  <option value="SAR">SAR(acceleration/maximum)</option>
                  <option value="WMA">WMA</option>
                  <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                  <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                  <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="ROC">ROC(days)</option>
                  <option value="OBV">OBV</option>
                  <option value="PVT">PVT</option>
                  <option value="WilliamR">WilliamR(days)</option>
                  <option value="MTM">MTM(days)</option>
                  <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
              </tr>
              <tr>
                <td>Input</td>
                <td><input type="text" name="BuyInput1_1" id="BuyInput1_1"></td>
                <td>Input</td>
                <td><input type="text" name="BuyInput1_2" id="BuyInput1_2"></td>
                <td>Input</td>
                <td><input type="text" name="BuyInput1_3" id="BuyInput1_3"></td>
              </tr>
              <tr>
                <td>Sell when: </td>
                <td><select id="Sell1_1" name="Sell1_1"onchange="AutoInput('Sell1_1', 'SellInput1_1')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="Close">Closing Price</option>
                  <option value="Open">Opening Price</option>
                  <option value="High">High</option>
                  <option value="Low">Low</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                 <option value="SAR">SAR(acceleration/maximum)</option>
                 <option value="WMA">WMA</option>
                 <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                 <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                 <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value="ROC">ROC(days)</option>
                 <option value="OBV">OBV</option>
                 <option value="PVT">PVT</option>
                 <option value="WilliamR">WilliamR(days)</option>
                 <option value="MTM">MTM(days)</option>
                 <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
                <td>IS:</td>
                <td><select id="Sell1_2" name="Sell1_2"onchange="AutoInput('Sell1_2', 'SellInput1_2')">
                  <option value="" selected></option>
                  <option value="Above">Above</option>
                  <option value="Below">Below</option>
                  <option value="AtLeast%Above%">At least % above (%)</option>
                  <option value="AtLeast%Below%">At Least % below (%)</option>
                </select></td>
                <td>Then the:</td>
                <td><select id="Sell1_3" name="Sell1_3"onchange="AutoInput('Sell1_3', 'SellInput1_3')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="Close">Closing Price</option>
                  <option value="Open">Opening Price</option>
                  <option value="High">High</option>
                  <option value="Low">Low</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                  <option value="SAR">SAR(acceleration/maximum)</option>
                  <option value="WMA">WMA</option>       
                  <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                  <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                  <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="ROC">ROC(days)</option>
                  <option value="OBV">OBV</option>
                  <option value="PVT">PVT</option>
                  <option value="WilliamR">WilliamR(days)</option>
                  <option value="MTM">MTM(days)</option>
                  <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
              </tr>
              <tr>
                <td>Input</td>
                <td><input type="text" name="SellInput1_1" id="SellInput1_1"></td>
                <td>Input</td>
                <td><input type="text" name="SellInput1_2" id="SellInput1_2"></td>
                <td>Input</td>
                <td><input type="text" name="SellInput1_3" id="SellInput1_3"></td>
              </tr>
            </table>
            <input type="submit" name="submit" value="Add"/>
        
        
        </form>
        
        </div>
        <input type="button" id="CheckPortfolio" value="Check Portfolio" onclick="ShowPortfolio()"/>
        <input type="button" id="CheckNewSymbols" value="Check For New Symbols" onclick="ShowNewSymbols()"/>
        <input type="button" id="EditStrategies" value="Edit strategies" onclick="EditStrategies()"/>
        <br />
        <div id="CheckPortfolio_div" style="display:none;" class="CSSTableGenerator">
        <?php
        
		CheckPortfolio($con);//Checks the users portfolio for strategy matches
        ?>      
        </div>
        <br />
        <div id="CheckNewSymbols_div" style="display:none;" >
        <?php
        
			CheckNewSymbols($con);//Checks the symbols not in the users portfolio for strategy matches
			
        ?>      
        </div>
        <br />
        <div id="EditStrategies_div" style="display:none;">
        <?php
        
		$Email=$_SESSION['email'];
		$result = mysqli_query($con,"SELECT * FROM  `strategies` WHERE `Email`='$Email'");
		while($row = mysqli_fetch_array($result)) {
			
		echo "<form  action='../Scripts/stockMonitoringProcess.php' method='post' id='Edit Strategy'>
        <label>Name:</label>
        <input type='text' id='Name' name='Name' value='$row[Name]' required='required'/>
        
        <table width='200' border='1'>
              <tr>
                <td>Buy when:</td>
                <td><select id='Buy1_1' name='Buy1_1'onchange='AutoInput('Buy1_1','BuyInput1_1')' >
                  <option value=$row[Buy1_1] selected>$row[Buy1_1] </option>
                  <option value='SMA'>Simple Moving Average (days)</option>
                  <option value='EMA'>Exponential Moving Average (days)</option>
                  <option value='Close'>Closing Price</option>
                  <option value='Open'>Opening Price</option>
                  <option value='High'>High</option>
                  <option value='Low'>Low</option>
                  <option value='Volume'>Volume</option>
                  <option value='Value'>Value</option>
                  <option value='RSI'>RSI</option>
                  <option value='SAR'>SAR(acceleration/maximum)</option>
                  <option value='WMA'>WMA</option>
                  <option value='BollingerUpper'>Bollinger band upper (days/Deviation)</option>           		 
                  <option value='BollingerLower'>Bollinger band lower (days/Deviation)</option>
                  <option value='MacD'>MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value='MacDSignal'>MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value='ROC'>ROC(days)</option>
                  <option value='OBV'>OBV</option>
                  <option value='PVT'>PVT</option>
                  <option value='WilliamR'>WilliamR(days)</option>
                  <option value='MTM'>MTM(days)</option>
                  <option value='fastSTCk'>fastSTC %K (%K,%D)</option>
                  <option value='fastSTCd'>fastSTC %D (%K,%D)</option>
                  <option value='DMIplus'>plus DMI(days)</option>
                  <option value='DMIminus'>minus DMI(days)</option>
                  
                </select></td>

                <td>IS:</td>
                <td><select id='Buy1_2' name='Buy1_2'onchange='AutoInput('Buy1_2','BuyInput1_2')'>
                  <option value=$row[Buy1_2] selected>$row[Buy1_2]</option>
                  <option value='Above'>Above</option>
                  <option value='Below'>Below</option>
                  <option value='AtLeast%Above%'>At least % above (%)</option>
                  <option value='AtLeast%Below%'>At Least % below (%)</option>
                </select></td>
                <td>Then the:</td>
                <td><select id='Buy1_3' name='Buy1_3'onchange='AutoInput('Buy1_3','BuyInput1_3')'>
                  <option value=$row[Buy1_3] selected>$row[Buy1_3]</option>
                  <option value='SMA'>Simple Moving Average (days)</option>
                  <option value='EMA'>Exponential Moving Average (days)</option>
                  <option value='Close'>Closing Price</option>
                  <option value='Open'>Opening Price</option>
                  <option value='High'>High</option>
                  <option value='Low'>Low</option>
                  <option value='Volume'>Volume</option>
                  <option value='Value'>Value</option>
                  <option value='RSI'>RSI</option>
                  <option value='SAR'>SAR(acceleration/maximum)</option>
                  <option value='WMA'>WMA</option>
                  <option value='BollingerUpper'>Bollinger band upper (days/Deviation)</option>           		  
                  <option value='BollingerLower'>Bollinger band lower (days/Deviation)</option>
                  <option value='MacD'>MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value='MacDSignal'>MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value='ROC'>ROC(days)</option>
                  <option value='OBV'>OBV</option>
                  <option value='PVT'>PVT</option>
                  <option value='WilliamR'>WilliamR(days)</option>
                  <option value='MTM'>MTM(days)</option>
                  <option value='fastSTCk'>fastSTC %K (%K,%D)</option>
                  <option value='fastSTCd'>fastSTC %D (%K,%D)</option>
                  <option value='DMIplus'>plus DMI(days)</option>
                  <option value='DMIminus'>minus DMI(days)</option>
                </select></td>
              </tr>
              <tr>
                <td>Input</td>
                <td><input type='text' name='BuyInput1_1' id='BuyInput1_1' value='$row[BuyInput1_1]'></td>
                <td>Input</td>
                <td><input type='text' name='BuyInput1_2' id='BuyInput1_2' value='$row[BuyInput1_2]'></td>
                <td>Input</td>
                <td><input type='text' name='BuyInput1_3' id='BuyInput1_3' value='$row[BuyInput1_3]'></td>
              </tr>
              <tr>
                <td>Sell when: </td>
                <td><select id='Sell1_1' name='Sell1_1'onchange='AutoInput('Sell1_1', 'SellInput1_1')'>
                  <option value=$row[Sell1_1] selected>$row[Sell1_1]</option>
                  <option value='SMA'>Simple Moving Average (days)</option>
                  <option value='EMA'>Exponential Moving Average (days)</option>
                  <option value='Close'>Closing Price</option>
                  <option value='Open'>Opening Price</option>
                  <option value='High'>High</option>
                  <option value='Low'>Low</option>
                  <option value='Volume'>Volume</option>
                  <option value='Value'>Value</option>
                  <option value='RSI'>RSI</option>
                 <option value='SAR'>SAR(acceleration/maximum)</option>
                 <option value='WMA'>WMA</option>
                 <option value='BollingerUpper'>Bollinger band upper (days/Deviation)</option>           		  
                 <option value='BollingerLower'>Bollinger band lower (days/Deviation)</option>
                 <option value='MacD'>MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value='MacDSignal'>MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value='ROC'>ROC(days)</option>
                 <option value='OBV'>OBV</option>
                 <option value='PVT'>PVT</option>
                 <option value='WilliamR'>WilliamR(days)</option>
                 <option value='MTM'>MTM(days)</option>
                 <option value='fastSTCk'>fastSTC %K (%K,%D)</option>
                  <option value='fastSTCd'>fastSTC %D (%K,%D)</option>
                  <option value='DMIplus'>plus DMI(days)</option>
                  <option value='DMIminus'>minus DMI(days)</option>
                </select></td>
                <td>IS:</td>
                <td><select id='Sell1_2' name='Sell1_2'onchange='AutoInput('Sell1_2', 'SellInput1_2')'>
                  <option value=$row[Sell1_2] selected>$row[Sell1_2]</option>
                  <option value='Above'>Above</option>
                  <option value='Below'>Below</option>
                  <option value='AtLeast%Above%'>At least % above (%)</option>
                  <option value='AtLeast%Below%'>At Least % below (%)</option>
                </select></td>
                <td>Then the:</td>
                <td><select id='Sell1_3' name='Sell1_3'onchange='AutoInput('Sell1_3', 'SellInput1_3')'>
                  <option value=$row[Sell1_3] selected>$row[Sell1_3]</option>
                  <option value='SMA'>Simple Moving Average (days)</option>
                  <option value='EMA'>Exponential Moving Average (days)</option>
                  <option value='Close'>Closing Price</option>
                  <option value='Open'>Opening Price</option>
                  <option value='High'>High</option>
                  <option value='Low'>Low</option>
                  <option value='Volume'>Volume</option>
                  <option value='Value'>Value</option>
                  <option value='RSI'>RSI</option>
                  <option value='SAR'>SAR(acceleration/maximum)</option>
                  <option value='WMA'>WMA</option>       
                  <option value='BollingerUpper'>Bollinger band upper (days/Deviation)</option>           		  
                  <option value='BollingerLower'>Bollinger band lower (days/Deviation)</option>
                  <option value='MacD'>MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value='MacDSignal'>MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value='ROC'>ROC(days)</option>
                  <option value='OBV'>OBV</option>
                  <option value='PVT'>PVT</option>
                  <option value='WilliamR'>WilliamR(days)</option>
                  <option value='MTM'>MTM(days)</option>
                  <option value='fastSTCk'>fastSTC %K (%K,%D)</option>
                  <option value='fastSTCd'>fastSTC %D (%K,%D)</option>
                  <option value='DMIplus'>plus DMI(days)</option>
                  <option value='DMIminus'>minus DMI(days)</option>
                </select></td>
              </tr>
              <tr>
                <td>Input</td>
                <td><input type='text' name='SellInput1_1' id='SellInput1_1' value='$row[SellInput1_1]'></td>
                <td>Input</td>
                <td><input type='text' name='SellInput1_2' id='SellInput1_2'value='$row[SellInput1_2]'></td>
                <td>Input</td>
                <td><input type='text' name='SellInput1_3' id='SellInput1_3'value='$row[SellInput1_3]'></td>
              </tr>
            </table>
            <input type='submit' name='submit' value='Edit'/>
			<input type='submit' name='submit' value='Delete'/>
        
        
        </form>";
		
		
		}
        ?>      

        </div>

    </div>
    <p><br class="clear" />
    </p>
  </div>
</div>
<div class="wrapper col6"></div>
<div class="wrapper col7">
  <div id="copyright">
    <p class="fl_left">Copyright &copy; 2011 - All Rights Reserved - <a href="#">Domain Name</a></p>
    <p class="fl_right">Template by <a href="http://www.os-templates.com/" title="Free Website Templates">OS Templates</a></p>
    <br class="clear" />
  </div>
</div>
<script type="text/javascript">
//Formating of forms for user
function AutoInput(textbox, textboxinput){

                if(document.getElementById(textbox).value=="SMA"){

                document.getElementById(textboxinput).value=50;
                }
                if(document.getElementById(textbox).value=="EMA"){

                document.getElementById(textboxinput).value=12;
                }
                if(document.getElementById(textbox).value=="Close"){

                document.getElementById(textboxinput).value ="none";
                }
                if(document.getElementById(textbox).value=="Open"){

                document.getElementById(textboxinput).value  = "none";
                }
                if(document.getElementById(textbox).value=="High"){

                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="Low"){

                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="Volume"){

                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="RSI"){

                document.getElementById(textboxinput).value = 14;
                }
                if(document.getElementById(textbox).value=="Value"){

                document.getElementById(textboxinput).value = 1;
                }
                if(document.getElementById(textbox).value=="SAR"){

                document.getElementById(textboxinput).value = "0.02/0.2";
                }
                if(document.getElementById(textbox).value=="WMA"){

                document.getElementById(textboxinput).value = 20;
                }
                if(document.getElementById(textbox).value=="BollingerUpper"){
 
                document.getElementById(textboxinput).value = "20/2";
                }
                if(document.getElementById(textbox).value=="BollingerLower"){

                document.getElementById(textboxinput).value = "20/2";
                }
                if(document.getElementById(textbox).value=="MacD"){

                document.getElementById(textboxinput).value = "12/26/9";
                }
                if(document.getElementById(textbox).value=="MacDSignal"){

                document.getElementById(textboxinput).value = "12/26/9";
                }
                if(document.getElementById(textbox).value=="ROC"){

                document.getElementById(textboxinput).value = 12;
                }
                if(document.getElementById(textbox).value=="WilliamR"){

                document.getElementById(textboxinput).value = 14;
                }
                if(document.getElementById(textbox).value=="MTM"){

                document.getElementById(textboxinput).value = 9;
                }
                if(document.getElementById(textbox).value=="fastSTCk"){

                document.getElementById(textboxinput).value = "20/5";
                }
                if(document.getElementById(textbox).value=="fastSTCd"){

                document.getElementById(textboxinput).value = "20/5";
                }
                if(document.getElementById(textbox).value=="DMIplus"){

                document.getElementById(textboxinput).value = 14;
                }
                if(document.getElementById(textbox).value=="DMIminus"){

                document.getElementById(textboxinput).value = 14;
                }
				if(document.getElementById(textbox).value=="PVT"){

                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="OBV"){

                document.getElementById(textboxinput).value = "none";
                }
				
				if(document.getElementById(textbox).value=="Above"){

                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="Below"){

                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="AtLeast%Above%"){

                document.getElementById(textboxinput).value = 15;
                }
                if(document.getElementById(textbox).value=="AtLeast%Below%"){

                document.getElementById(textboxinput).value = 15;
                }
                
                
    }
    </script>
    

</body>
</html>
